<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>     

<title>特约商户录入</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"
	rel="stylesheet" />

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript"
	src="<s:url value="/js/jquery.blockUI.js" />"></script>
	<script type="text/javascript"
	src="<s:url value="/js/ajaxfileupload.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/AddressQuery.js"/>'></script>
<style type="text/css">
.fieldError {
	color: red;
	text-align: left;
}

.error {
	float: none;
	color: red;
	padding-left: .5em;
	vertical-align: top;
}

table th {
	font-weight: bolder;
	text-align: left;
	background-color: #5599FF;
}
</style>
<script type="text/javascript" language="javaScript">
//选择序列号（ 传入值为table行数）
    function showPosInfoWindow(str){
    
     var ScreenWidth = screen.availWidth ;
     var ScreenHeight = screen.availHeight; 
     var StartX = (ScreenWidth - innerWidth) / 2 ;
     var StartY = (ScreenHeight - innerHeight) / 2 ;
	 var url =  "<%=basePath %>termAgentSn/termSnAgentInit.ct?serNums="+str;
	
	 window.open(url, '终端序列号信息', 'left='+ StartX + ', top='+ StartY + ', Width=' + innerWidth +', height=' + innerHeight + ', resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, location=no'); 
	}
	var currentTerNum=1;
	$(document).ready(function() {
		///date
		var mydate =new Date();
		var y=mydate.getFullYear();
		var m=mydate.getMonth()+1; 
		if(m<10){
			m='0'+m;
		}
		var d=mydate.getDate();
		if(d<10){
			d='0'+d;
		}
		$("#curDate").val(y+"-"+m+"-"+d); 
		//moren amt
		$("#commAmt").val("0.00");
		$("#commAmt").attr("readonly","true");
		$("#commAmt").css("background-color","lightgray");
		 //mcctype
		 loadSorts(); 
		 $("#commModes").change(function (){
		 	changeRate();
		 });  
		 
		 amtInit();
		 
		 //修改交易类型
		 $("#allCheck").click(function (){
			 	if(this.checked==true){
			 		$("input[name='transTypes']").attr("checked","true"); 
			 	}else{
			 		$("input[name='transTypes']").removeAttr("checked");
			 	}
		 		
		 	});
		
		//$("#file13Content").hide();
		$("#merinfoForm").validate({
			debug : true,
			submitHandler : function(form) {
			
			    if(!checkBusinessLicense()){
			      return false;
			    }
			    if(!checkCardNo()){
			      return false;
			    }
			    if(!checkMer()){
			      return false;
			    }
			    
			     var trans=$("input[name='transTypes']:checked").length;
			     if(trans<1){
				   alert("请选择需要开通的功能!");
				   return false;
				 }
			    
			    
				var terNum=$("#terminalNums").val();
				var terCurrNum=$("input[name=statIndex]").length;
				
				if(terNum!=terCurrNum)	{
					alert("实际添加终端与申请终端数量不符，请重新填写！");
				}else{
					form.submit();
				}
			},
			rules : {
				"merinfo.merKind" : {required : true},  //商户类型
				"merinfo.areaCode" : {required : true}, //所属地区
				"merDetail.terNum" : {required : true,isNumber:true}, //申请终端数量
				"mccTypes" : {required : true}, //行业类别
				"merinfo.mcc" : {required : true},//mcc 
				"merinfo.merName" : {required : true}, //merinfo  name
				"merinfo.engName" : {required : true}, //merinfo  name
				"merinfo.merBrName":{required:true},
				"merinfo.engBrName" : {required : true}, //merinfo  name
				"merinfo.settBackId" : {required : true}, 
				"merinfo.tel" : {required : true,isTel:true},
				"merinfo.insertContact" : {required : true},
				"merinfo.commMode" : {required : true},
				"merDetail.cycleId" : {required : true},
				"merinfo.commRate" : {required : true,isDecimal: function(){
														var min = 0;
														var max = 9.9999;
														var accuracy = 4;
														return [min, max, accuracy];}
									},
				"merinfo.commAmt" : {required : true,isDecimal: function(){
														var min = 0;
														var max = 999999999999;
														var accuracy = 2;
														return [min, max, accuracy];}},
				"merinfo.addr" : {required : true},
				"merinfo.email" : {email : true},
				"merinfo.zipCode":{isZipCode:true},
				"merinfo.accNo":{number:true},
				"merDetail.personalPhone":{required:true,isMobile:true},
				"merDetail.cardNo":{isIdCardNo:true,required:true},
				"merDetail.organizationCode":{required:true,strCode:true},
				"merDetail.bankLicense":{strCode:true},
				"merDetail.businessLicences":{required:true,strCode:true},
				"merDetail.personalName":{required:true},
				"termBeanList[0].termName":{required:true},
				"termBeanList[0].termAddress":{required:true},
				"termBeanList[0].serialNum":{required:true},
				"termBeanList[1].termName":{required:true},
				"termBeanList[1].termAddress":{required:true},
				"termBeanList[1].serialNum":{required:true},
				"termBeanList[2].termName":{required:true},
				"termBeanList[2].termAddress":{required:true},
				"termBeanList[2].serialNum":{required:true},
				"termBeanList[3].termName":{required:true},
				"termBeanList[3].termAddress":{required:true},
				"termBeanList[3].serialNum":{required:true},
				"termBeanList[4].termName":{required:true},
				"termBeanList[4].termAddress":{required:true},
				"termBeanList[4].serialNum":{required:true},
				"merinfo.accBack":{required:true},
				"merinfo.accNo":{required:true,isNumber:true},
				"merinfo.contact":{required:true},
				"merinfo.merberFee":{required:true},
				"merinfo.merberFeeAmt":{required:true},
				"merinfo.mid":{required:true},
				"file":{required:true},
				
				"file9":{required:true},
				"file5":{required:true},
				"file8":{required:true},
				"file10":{required:true},
				"file11":{required:true},
				"file2":{required:true},
				"file12":{required:true},
				"file13":{required:true},
				"file7":{required:true}
				
			},
			messages : {
				"merinfo.merKind" : {required : "必选"},  //商户类型
				"merinfo.areaCode" : {required : "必填"}, //所属地区
				"merDetail.terNum" : {required :"必填"}, //申请终端数量
				"mccTypes" : {required : "必选"}, //行业类别
				"merinfo.mcc" : {required : "必选"},//mcc 
				"merinfo.merName" : {required : "必填"}, //merinfo  name
				"merinfo.merBrName":{required:"必填"}, 
				"merinfo.engName" : {required : "必填"}, //merinfo  name
				"merinfo.engBrName":{required:"必填"}, 
				"merinfo.settBackId" : {required : "必选"}, 
				"merinfo.tel" : {required : "必填"},
				"merinfo.insertContact" : {required : "必填"},
				"merinfo.commMode" : {required : "必填"},
				"merDetail.cycleId" : {required : "必填"},
				"merinfo.commRate" : {required : "必填"},
				"merinfo.commAmt" : {required : "必填"},
				"merinfo.addr" : {required : "必填"},
				"merinfo.email" : {email : "邮箱地址不正确"},
				"merinfo.zipCode":{isZipCode:"邮编格式不对"},
				"merinfo.accNo":{number:"必须为整数"},
				"merDetail.personalPhone":{required:"必填"},
				"merDetail.cardNo":{required:"必填"},
				"merDetail.organizationCode":{required:"必填",isABC:"英文或数字"},
				"merDetail.bankLicense":{isABC:"英文或数字"},
				"merDetail.businessLicences":{required:"必填",isABC:"英文或数字"},
				"merDetail.personalName":{required:"必填"},
				"termBeanList[0].termName":{required:"必填"},
				"termBeanList[0].termAddress":{required:"必填"},
				"termBeanList[0].serialNum":{required:"必填"},
				"termBeanList[0].tid":{required:"必填"},
				"termBeanList[1].termName":{required:"必填"},
				"termBeanList[1].termAddress":{required:"必填"},
				"termBeanList[1].serialNum":{required:"必填"},
				"termBeanList[1].tid":{required:"必填"},
				"termBeanList[2].termName":{required:"必填"},
				"termBeanList[2].termAddress":{required:"必填"},
				"termBeanList[2].serialNum":{required:"必填"},
				"termBeanList[2].tid":{required:"必填"},
				"termBeanList[3].termName":{required:"必填"},
				"termBeanList[3].termAddress":{required:"必填"},
				"termBeanList[3].serialNum":{required:"必填"},
				"termBeanList[3].tid":{required:"必填"},
				"termBeanList[4].termName":{required:"必填"},
				"termBeanList[4].termAddress":{required:"必填"},
				"termBeanList[4].serialNum":{required:"必填"},
				"termBeanList[4].tid":{required:"必填"},
				"merinfo.accBack":{required:"必填"},
				"merinfo.accNo":{required:"必填"},
				"merinfo.contact":{required:"必填"},
				
				"merinfo.merberFee" : {required : true,isDecimal: function(){
														var min = 0;
														var max = 1;
														var accuracy = 4;
														return [min, max, accuracy];}
									},
				"merinfo.merberFeeAmt" : {required : "必填"},
				
				"merinfo.mid" : {required : "必填"},
				
				"file":{required:"请上传"},
				
				"file9":{required:"请上传"},
				"file5":{required:"请上传"},
				"file8":{required:"请上传"},
				"file10":{required:"请上传"},
				"file11":{required:"请上传"},
				"file2":{required:"请上传"},
				"file13":{required:"请上传"},
				"file12":{required:"请上传"},
				"file7":{required:"请上传"}
				
				
			},errorPlacement: function(error, element) { 
			    if ( element.is(":radio") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is(":checkbox") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is("input") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is("select") ) 
			        error.appendTo ( element.parent() ); 
			    else 
			        error.insertAfter(element); 
			} 

		});
		
		//终端信息
		$("#terminalDiv").click(function(){
				
						var table=$("#istable").get(0);
					    var count=5;
						var lengths=table.rows.length;
						if(lengths > count*4+2){
							return false;
						}
						
				     var a=""
				     +"<tr><td align='right' width='20%'>门店名称：</td><td align='left'><input type='text' maxlength='50' class='queryWidth' name='termBeanList["+parseInt(lengths/4)+"].termName'/><font color='red'>*</font></td><td align='right' width='20%'>终端号：</td><td align='left'><input type='text' maxlength='50' class='queryWidth' name='termBeanList["+parseInt(lengths/4)+"].tid' id='tid"+parseInt(lengths/4)+"' onblur='checkTidExist(this.value)' /><font color='red'>*</font></td><td> <input type='button' onclick='deleteRows(this)' value='删除' /></td></tr>"
				     +"<tr><td align='right' width='20%'>机器序列号：</td><td align='left' ><input type='text' maxlength='20' id='serialNum"+lengths+"'  class='queryWidth'  name='termBeanList["+parseInt(lengths/4)+"].serialNum' style='background-color: lightgray' readonly='readonly'/><font color='red'>*</font><input type='button'  onclick='showPosInfoWindow("+lengths+")' value='选择'/></td>"
				     +"<td align='right' width='20%'>终端安装地址：</td><td colspan='2' align='left'><input type='text' maxlength='50' class='someWidth' name='termBeanList["+parseInt(lengths/4)+"].termAddress'/><font color='red'>*</font></td></tr>"
				     +"<tr><td align='right' width='20%'>备注：</td><td colspan='4' align='left'><input type='text' maxlength='65'  class='someWidth'  name='termBeanList["+parseInt(lengths/4)+"].termNote'/></td></tr>"
				     +"<tr><td colspan='5'><input name='statIndex'  type='hidden' /></td></tr>"
				     +"";
				     $("#istable").append(a);
				     currentTerNum=currentTerNum+1;
				     return false;
				});
				
				$("#delTr").click(function(){
					var tb=document.getElementById("istable");
				    var lengths=tb.rows.length;
				    
				    if(lengths > 7){
					    tb.deleteRow(lengths-1);
					    tb.deleteRow(lengths-2);
					    tb.deleteRow(lengths-3);
					    tb.deleteRow(lengths-4);
					    tb.deleteRow(lengths-5);
				    }
				    
				    return false;
				});
				
				
			
	}); 
	//终端
	function deleteRows(input){
		var a=input.parentNode.parentNode.rowIndex;
		var table=$("#istable").get(0);
		
		table.deleteRow(a+3);//删除
		table.deleteRow(a+2);
		table.deleteRow(a+1);
		table.deleteRow(a);
		
	}
	//s c  img
	 function ajaxFileUpload(ids){
				var id=$("#"+ids).val();
				if(id=="" ||id==null){
					alert("请选择需要上传的图片~！");
					return;
				}
                $.ajaxFileUpload(
                    {
                 url:'<s:url value="/mer/addMerinfoImg.ct" />',            //需要链接到服务器地址
                 secureuri:false,
                 fileElementId:ids,                         
                 dataType: 'String',
                 success: function (a) { 
                 	a=a.replace("<pre>","");
                    a=a.replace("</pre>","");
                    var mess=a.substring(0,4);
                  if(mess=="http"){
                  	 var fonts="#"+ids+"Font";    
                      $(fonts).html("上传成功！");
                      
                       var inputs="#"+ids+"Iput";
                      
                      $(inputs).val(a);
                  }else{
                  	 var fonts="#"+ids+"Font";    
                      $(fonts).html("文件格式不正确！");
                  }
                 	
                 },
                 error: function (data, status, e) {
                 		 var fonts="#"+ids+"Font";    
                      $(fonts).html("上传失败！请检查网络或联系管理员！");
                 }
             }
                    
                );
               
           }
	/////加载
	//清空显示选择提示
	  	function clearSelect(sid) {
			$("#" + sid).empty().append("<option value=''>--请选择--</option>");
		}
		//进行遍历存值
	  	function fillSelect_sort(sid, address) {
	  		
				if (!address || !sid) {
					return;
				}
				var $select = $("#" + sid);
				$select.empty();
				if (address.length != 1) {
					$select.append("<option value=''>--请选择--</option>");
				}
				
				for ( var i = 0; i < address.length; i++) {
					$select.append("<option value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
					
				}
		}
		//加载一级类别
		function loadSorts() {
		 	
			/* MccQuery.loadMccType(function (sorts){
				clearSelect("mccCodes");
				
				fillSelect_sort("mccTypes", sorts);
				loadMccCode();
			}); */
			clearSelect("mccCodes");
			AddressQuery.loadProvices(function(objs){
				clearSelect("citys");
				clearSelect("bankBranchs");
				
				fillSelect_sort("provinces", objs);
				loadCity();
			});
			/* AddressQuery.loadPayBank( function(sortSmall) {
				clearSelect("bankBranchs");
				fillSelect_sort("banks", sortSmall);
				loadBankBranch();
			}); */
		}
		//加载二级类别
		 function loadMccCode() {
			var sortCode = $("#mccTypes").val();
			var sortCodeOld = $("#mccTypes").val();
			
			var array = sortCode.split("-");
			if(array!=null && array.length ==2){
			sortCode = array[0];
			}
			if (!sortCode) {
				return;
			}
			loadCommMode(sortCodeOld);
			MccQuery.loadMccCode(sortCode, function(sortSmall) {
				fillSelect_sort("mccCodes", sortSmall);
			});
		}
		//load　　city
		 function loadCity() {
			var sortCode = $("#provinces").val();
			$("#citys").val("");
			 $("#banks").val("");
			 $("bankBranchs").val("");
			if (!sortCode) {
				return;
			}
			AddressQuery.loadCitys(sortCode, function(sortSmall) {
					
				fillSelect_sort("citys", sortSmall);
				
			});
		}
		//load bank
		function loadBank(){
			 $("#banks").val("");
			 $("bankBranchs").val("");
		}
		//load　bankBranch
		 function loadBankBranch() {
			var b = $("#banks").val();
			var p=$("#provinces").val();
			var c=$("#citys").val();
			 $("bankBranchs").val("");
			if(p=="" || c==""){
				alert("请选择开户行所在地");
				return;
			}
			
			
			AddressQuery.loadPayBankBranch(b,p,c ,function(sortSmall) {
				fillSelect_sort("bankBranchs", sortSmall);
			});
			
		}
		function accBackName(){
			var a= $("#banks  option:selected").text();
			var b= $("#bankBranchs  option:selected").text();
			$("#accBack").val(a+b);
		
		}
		//企业类别
		function merkindChange(obj){
			 if(obj.value=="02"){//个人
			 	$("#bankLin").val("");
			  
			 	$("#organCodes").val("");
				$("#bankLin").attr("disabled","true");
				 
				$("#organCodes").attr("disabled","true");
				$("#bankLin").css("background-color","lightgray");
				 
				$("#organCodes").css("background-color","lightgray");
				$("#file1Content").hide();
				$("#file3Content").hide();
				//$("#file4Content").hide();
				//$("#file13Content").show();
				$("#taxRegCerRed").hide();
			}else{
				$("#bankLin").removeAttr("style");
				 
				$("#organCodes").removeAttr("style");
				$("#bankLin").removeAttr("disabled");
				 
				$("#organCodes").removeAttr("disabled");
				$("#file1Content").show();
				$("#file3Content").show();
				//$("#file4Content").show();
				$("#taxRegCerRed").show();
				
			}
			
			$("#merKindRadio").val(obj.value); 
			amtInit();
		}
		//申请终端数量
		function terminalNum(obj){
			if(obj.value>5){
				obj.value=5;
			}
		}
		
		function valiTaxRegCer(){
			var merKindRadio = $("#merKindRadio").val();
			var taxRegCer = $("#taxRegCer").val();
			if(merKindRadio=="01"){
			  if(taxRegCer==null || taxRegCer==""){
			  alert("企业商户的税务登记证不能为空");
			  return true;
			  }
			}
		  return false;
		}
			
    function choiseBank(){
    
	    var ScreenWidth = screen.availWidth ;
	    var ScreenHeight = screen.availHeight; 
	    var StartX = (ScreenWidth - 350) / 2 ;
	    var StartY = (ScreenHeight - 250) / 2 ;
    
		var url =  "<%=basePath %>mer/openBankMes.ct";
		var bankMes = window.showModalDialog(url,null,"dialogWidth=350px;dialogHeight=250px;dialogLeft="+StartX+";dialogTop="+StartY+"; ");
		
		if(bankMes==null || bankMes == "" || bankMes == "undefined"){
		 return false;
		}
		
		var array = bankMes.split("-");
		if(array==null || array.length !=2){
		 return false;
		}
		$("#accBack").val(array[0]);
		$("#bankBranchs").val(array[1]);
	
	}
	
	//检测营业执照号
	function checkBusinessLicense(){
	
	  var value = $("#busLicences").val();
	  if(value==""){
	   return true;
	  }
	  AddressQuery.checkBusLicences(value, function(backMes) {
	  
	   if(backMes=="true"){
	    alert("营业执照号"+value+"已经存在");
	    return false;
	   }	  
	  });
	  return true;
	}
	
	//检测证件号 最多允许4次
	function checkCardNo(){
	  
	  var value = $("#cardNo").val();
	  if(value==""){
	   return true;
	  }
	  AddressQuery.checkCardNo(value, function(backMes) {
	  
	   if(backMes=="true"){
	    alert("证件号:"+value+"已经超出使用次数");
	    return false;
	   }	  
	  });
	  
	  return true;
	
	}
	
	//检测一机一码商户号
	function checkMer(){

	  var value = $("#mid").val();
	  if(value==""){
	   return true;
	  }
	  AddressQuery.checkMidExist(value, function(backMes) {
	  
	   if(backMes=="true"){
	    alert("商户号"+value+"已经存在");
	    return false;
	   }	  
	  });
	  return true;
	}
	
		//检测一机一码终端号
	function checkTidExist(value){
	
	  if(value==""){
	   return true;
	  }
	  AddressQuery.checkTidExist(value, function(backMes) {
	  
	   if(backMes=="true"){
	    alert("终端号"+value+"已经存在");
	    return false;
	   }	  
	  });
	  return true;
	}
	
	//根据行业类别转换扣率类型 
	function loadCommMode(sortCode){
	if(sortCode=="01-1" || sortCode=="02-1"  || sortCode=="05-1" ||  sortCode=="07-1" || sortCode=="09-1"){
		 $("#commModes").attr("value","1");
		   changeRate();
	 }else if(sortCode=="01-3"){
	    $("#commModes").attr("value","3");
	     changeRate();
	 }
	 
	}
	//修改商户扣率类型
	function changeRate(){
	  var val=$("#commModes").val();
		 	 if(val==1){
		 	   
		 	    var sortCode = $("#mccTypes").val();
		 	    
		 	    if(sortCode=="01-3"){
		 	        alert("该行业类别不允许点数");
		 	       $("#commModes").attr("value","3");
		 	       return false;
		 	    }
		 	 
		 	 
		 	 	$("#commAmt").val("0.00");
		 	 	$("#rate").removeAttr("readonly");
		 	 	$("#rate").removeAttr("style");
		 	 	$("#commAmt").attr("readonly","true");
		 	 	$("#commAmt").css("background-color","lightgray");
		 	 }else if(val==3){
		 	    
		 	     var sortCode = $("#mccTypes").val(); 
		 	   if(sortCode=="01-1" || sortCode=="02-1"  || sortCode=="05-1" ||  sortCode=="07-1" || sortCode=="09-1"){
		 	       alert("该行业类别不允许封顶");
		 	       $("#commModes").attr("value","1");
		 	       return false;
		 	      } 
		 	    
		 		 $("#rate").removeAttr("readonly");
		 		 $("#rate").removeAttr("style");
		 		 $("#commAmt").removeAttr("style");
		 	 	$("#commAmt").removeAttr("readonly");
		 	 }
	
	}
	
	
	function amtInit(){
	
	  var merKind = $("#merKindRadio").val(); 
		if(merKind=="02"){//个体
		  $("#amount").val("20000");
		  $("#amountDay").val("100000");
		  $("#amountMouth").val("1000000");
		  $("#amount1").val("20000");
		  $("#amountDay1").val("100000");
		  $("#amountMouth1").val("1000000");
		}else{//企业
		  $("#amount").val("20000");
		  $("#amountDay").val("150000");
		  $("#amountMouth").val("1500000");
		  $("#amount1").val("20000");
		  $("#amountDay1").val("150000");
		  $("#amountMouth1").val("1500000");
		}
	
	}
		
</script>

</head>

<body>
	
		<div class="subpage">
			<s:form id="merinfoForm" action="/mer/addMerinfoForReal.ct" method="post"  theme="simple" enctype="multipart/form-data" >  
				<div class="user_title">
					<h2 class="headline-inquires">POS收单运营管理平台<br />
	    		 <span class="sub-title">
						<s:hidden name="termapply.merchantNo" value="%{termapply.merchantNo}"/>
			            <s:hidden name="termapply.id" value="%{termapply.id}"/>
			            <s:hidden name="merinfo.merberFlag" value="%{#session.session_merchant.merberFlag}"/>
	    	 	 </span></h2>
				</div>
				<table width="100%" border="1" cellspacing="0" class="table">
					<tr>
						<td colspan="4" align="center">

							<h2 class="headline-inquires">
								 一机一码商户申请<br />
								<span class="sub-title"></span>
							</h2>
						</td>
					</tr>
					<tr>
						<td  style="width:150px;text-align: right;">申请人：</td>
						
						<td  style="text-align: left;"> <s:textfield value="%{#request.op.accountNo}" disabled="true"/> </td>
						<td style="width:150px;text-align: right">申请日期：</td>
						
						<td style="text-align: left;"> <s:textfield id="curDate" disabled="true"/> </td>
					</tr>
					
					<tr>
						<th colspan="6">商户基本信息</th>
					</tr>
					
					<tr>
					
					 <td style="text-align: right">商户类型：</td>
						
						<td style="text-align: left;"><s:radio id="merKind"  onchange="merkindChange(this)"  name="merinfo.merKind" list="#{'01':'企业单位','02':'个体工商户' }"  value="%{'01'}" ></s:radio> <font color="red">*</font> 
						<s:hidden id="merKindRadio" value="01" />
						</td>
					
					<s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
					<td style="text-align: right"></td>
					<td>
					  <s:hidden name="merinfo.belongBranch" value="%{#session.session_merchant.orgCode}" />
					</td>
					</s:if>
					
					<s:else>
					  <td style="text-align: right">所属机构：</td>
						
						<td style="text-align: left;"> <s:select cssClass="queryWidth" name="merinfo.belongBranch" id="orgCode"
								list="#request.orgList" listKey="org_code" listValue="org_name"/><font color="red">*</font></td>
					</s:else>
						
						
					</tr>
					<tr>
						<td style="text-align: right">商户名称：</td>
						
						<td style="text-align: left;"><s:textfield name="merinfo.merName" cssClass="queryWidth" maxLength="50"/>
						<font color="red">*</font> </td>
						<td style="text-align: right">营业名称：</td>
						
						<td style="text-align: left;"><s:textfield name="merinfo.merBrName" cssClass="queryWidth" maxLength="50" /> <font color="red">*</font></td>
					</tr>
					
					<tr>
						<td style="text-align: right">商户号：</td>
						
						<td style="text-align: left;"><s:textfield id="mid" name="merinfo.mid" cssClass="queryWidth" maxLength="15" onblur="checkMer()"/>
						<font color="red">*</font> </td>
						
						<td style="text-align: right"></td>
						<td style="text-align: left;"></td>
					</tr>
					
					<tr>
						<td style="text-align: right">注册地址：</td>
						<td style="text-align: left;" colspan="3"><s:textfield name="merinfo.addr"
								cssStyle="width:95%;" maxlength="30"></s:textfield><font color="red">*</font></td>
					</tr>
					<tr>
						<td style="text-align: right">营业起始时间：</td>
						
						<td style="text-align: left;"> 
						<s:select  name="merinfo.engName" list="#{'000000':'000000','010000':'010000','020000':'020000','030000':'030000','040000':'040000','050000':'050000','060000':'060000','070000':'070000','080000':'080000','090000':'090000','100000':'100000','110000':'110000','120000':'120000','130000':'130000','140000':'140000','150000':'150000','160000':'160000','170000':'170000','180000':'180000','190000':'190000','200000':'200000','210000':'210000','220000':'220000','230000':'230000'}"  cssClass="queryWidth" 
						 headerKey="080000" headerValue="080000"/> 
						<font color="red">*</font>
						</td>
						<td style="text-align: right">营业终止时间：</td>
						
						<td style="text-align: left;">
						<s:select  headerKey="215959" headerValue="215959" name="merinfo.engBrName" list="#{'005959':'005959','015959':'015959','025959':'025959','035959':'035959','045959':'045959','055959':'055959','065959':'065959','075959':'075959','085959':'085959','095959':'095959','105959':'105959','115959':'115959','125959':'125959','135959':'135959','145959':'145959','155959':'155959','165959':'165959','175959':'175959','185959':'185959','195959':'195959','205959':'205959','215959':'215959','225959':'225959','235959':'235959'}"  cssClass="queryWidth" /> 
						
						<font color="red">*</font></td>
					</tr>
					<tr>
						<td style="text-align: right">所属地区：</td>
						
						<td style="text-align: left;"><s:select name="merDetail.areaCode" list="#request.areaList"  listKey="key" listValue="value" cssClass="queryWidth" /> <font color="red">*</font></td>
						
						<td style="text-align: right">申请终端数量：</td>
						
						<td style="text-align: left;"><s:textfield id="terminalNums" name="merDetail.terNum" cssClass="queryWidth" maxLength="1" onkeyup="terminalNum(this)"/> <font color="red">*</font></td>		
						
					</tr>
					<tr>
						<td style="text-align: right">行业类别：</td>
						
						<td style="text-align: left;">
						 <input id="categoryCode" value="<s:property value="tmw.sortOne"/>" type="hidden" />
   					  	<s:select id="mccTypes" list="#request.mccList"  onchange="loadMccCode()" name="mccTypes" headerKey="99" headerValue="--请选择--"  cssClass="queryWidth"></s:select> <font color="red">*</font>
						  </td>
						<td style="text-align: right">mcc码：</td>
						<td style="text-align: left;">
							<input id="moduleCode" value="<s:property value="tmw.sortTwo"/>" type="hidden" />
   							<select id="mccCodes" name="merinfo.mcc"  class="queryWidth"></select> <font color="red">*</font>
						 </td>
					</tr>
					<tr>
						<td style="text-align: right">结算周期：</td>
						
						<td style="text-align: left;"><s:select name="merDetail.cycleId" list="#request.cycList" listKey="cycleId" listValue="cycleName"  cssClass="queryWidth"></s:select> </td>
						<td style="text-align: right">商户扣率类型：</td>
						
						<td style="text-align: left;"><s:select id="commModes" name="merinfo.commMode" list="#{'1':'点数','3':'封顶' }" cssClass="queryWidth" /> </td>
						
					</tr>
					<tr>
						<td style="text-align: right" >商户扣率：</td>
						
						<td style="text-align: left;"><s:textfield id="rate" name="merinfo.commRate" cssClass="queryWidth" maxLength="6"/><font color="red">*</font><font color="blue">(%)</font> </td>
						
						<td style="text-align: right">封顶手续费金额：</td>
						
						<td style="text-align: left;"><s:textfield id="commAmt" name="merinfo.commAmt" cssClass="queryWidth" maxLength="14"/> <font color="red">*</font></td>
						
					</tr>
					
				<s:if test="#session.session_merchant.merberFlag==\"01\" ">	
					<tr>
					   <td style="text-align: right">折扣类别</td>
					   <td style="text-align: left;">
					     <s:select id="merberFeeType" name="merinfo.merberFeeType" list="#{'1':'点数'}" cssClass="queryWidth" />
					   </td>
					   
						<td style="text-align: right">折扣比率</td>
						<td style="text-align: left;">
						 <s:textfield id="merberFee" name="merinfo.merberFee" cssClass="queryWidth" maxLength="14"/>
						 <font color="blue">(说明:8折填写0.8)</font> <font color="red">*</font> 
						</td>
					</tr>
					
					<tr>
					   <td style="text-align: right">封顶值</td>
					   <td style="text-align: left;">
					     <s:textfield id="merberFeeAmt" name="merinfo.merberFeeAmt" cssClass="queryWidth" maxLength="14"/>
						 <font color="red">*</font> 
					   </td>
					   
						<td style="text-align: right"></td>
						<td style="text-align: left;"></td>
					</tr>
					
				</s:if>

					<tr>
						<td style="text-align: right">开户银行：</td>
						
						<td style="text-align: left;">
						<s:textfield id="accBack" name="merinfo.accBack" cssClass="someWidth2" maxLength="50" readonly="true"/>
						<font color="red">*</font> 
						<input type="button" onclick="choiseBank();" value="选择">
						</td>
						
						<td style="text-align: right">开户银行代码：</td>
						
						<td style="text-align: left;">
						<s:textfield id="bankBranchs"  name="merinfo.settBackId" readonly="true" cssClass="queryWidth"/>
						<font color="red">*</font>
						</td>
						
						
					</tr>
					
					<tr>
					   	<td style="text-align: right">开户行账户类型:</td>
						<td style="text-align: left;"><s:select id="accType" name="merinfo.accType" list="#{'01':'对公','02':'对私' }" cssClass="queryWidth" /> </td>
						
					    <td style="text-align: right"></td>
						<td style="text-align: left;"></td>
					</tr>
					
					<tr>
					    <td style="text-align: right">开户行账号：</td>
						
						<td style="text-align: left;">
							<s:textfield name="merinfo.accNo"   cssClass="queryWidth" maxLength="30"/><font color="red">*</font>
						 </td>
					
						<td style="text-align: right">开户行账户名：</td>
						
						<td style="text-align: left;">
							<s:textfield name="merinfo.contact" cssClass="queryWidth" maxLength="50"/><font color="red">*</font>
						 </td>
						
					</tr>
					
					<tr>
					   <td style="text-align: right">业务联系人电话：</td>
						
						<td style="text-align: left;"> <s:textfield name="merinfo.tel" cssClass="queryWidth" maxLength="20"/><font color="red">*</font> </td>
					
						<td style="text-align: right">业务联系人：</td>
						
						<td style="text-align: left;"><s:textfield name="merinfo.insertContact" cssClass="queryWidth" maxLength="10"/><font color="red">*</font> </td>
						
					</tr>
					
					
					
					<tr>
						<td style="text-align: right">法人姓名：</td>
						
						<td style="text-align: left;"><s:textfield name="merDetail.personalName" cssClass="queryWidth" maxLength="15"/> <font color="red">*</font></td>
						<td style="text-align: right">法人手机号 ：</td>
						
						<td style="text-align: left;"><s:textfield name="merDetail.personalPhone"   cssClass="queryWidth" maxLength="11" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td style="text-align: right">法人证件类型：</td>
						
						<td style="text-align: left;">
							<s:select cssClass="queryWidth" name="merDetail.cardType" id="cardType"
								list="#{'01':'身份证' }" />
						</td>
						<td style="text-align: right">法人证件号码 ：</td>
						
						<td style="text-align: left;" ><s:textfield id="cardNo" name="merDetail.cardNo"  maxLength="30" cssClass="queryWidth" onblur="checkCardNo()" /><font color="red">*</font> </td>
					</tr>
					<tr>
						
						<td style="text-align: right">营业执照号 ：</td>
						
						<td style="text-align: left;"><s:textfield id="busLicences" name="merDetail.businessLicences" maxLength="35"  cssClass="queryWidth" onblur="checkBusinessLicense()" /><font color="red">*</font> </td>
						<td style="text-align: right">税务登记证：</td>
						
						<td style="text-align: left;"><s:textfield id="taxRegCer" name="merDetail.taxRegCer" maxLength="35" cssClass="queryWidth"/> 
						<font id="taxRegCerRed" color="red">*</font>
						</td>
					</tr>
					<tr>
						
						<td style="text-align: right">组织机构代码 ：</td>
						
						<td style="text-align: left;"><s:textfield id="organCodes" name="merDetail.organizationCode" maxLength="35"  cssClass="queryWidth" /><font color="red">*</font> </td>
						<td style="text-align: right">开户许可证：</td>
						<td style="text-align: left;"><s:textfield id="bankLin" name="merDetail.bankLicense" maxLength="35" cssClass="queryWidth"/> </td>
					</tr>
					<tr>
						<td style="text-align: right">传真：</td>
						
						<td style="text-align: left;"><s:textfield name="merinfo.fax" cssClass="queryWidth" maxLength="20"/> </td>
						<td style="text-align: right">邮件：</td>
						
						<td style="text-align: left;"><s:textfield name="merinfo.email" cssClass="queryWidth" maxLength="40" /> </td>
					</tr>
					
					<tr>
					   <td style="text-align: right">邮编：</td>
						
					   <td style="text-align: left;"><s:textfield name="merinfo.zipCode" cssClass="queryWidth" maxLength="8"/> </td>
					</tr>
					
					<tr>
						<td style="text-align: right">备注：</td>
						<td style="text-align: left;" colspan="3"><s:textarea onpropertychange="checkLength(this,120);" oninput="checkLength(this,120);" rows="5" id="memos" cssStyle="width:95%;"
								name="merinfo.memo"  /></td>

					</tr>
					<tr>
						<th colspan="6">终端信息</th>
					</tr>
					<tr>
						<td colspan="4">
								<table id="istable" width="100%" cellpadding="0" cellspacing="0" border="0"
									class="table">
					
									<tr>
										<td colspan="5" align="center">
											<h2 class="headline-inquires">
												终端录入<br />
												<span class="sub-title"></span>
											</h2>
					
										</td>
									</tr>
					
					
									<tr>
										<td colspan="5">&nbsp;</td>
									</tr>
									
									<tr>
										<td align="right" width="20%">门店名称：</td>
										<td align="left"><input type="text" maxlength="50" class="queryWidth"  name="termBeanList[0].termName"/><font color="red">*</font></td>
										<td align="right" width="20%">终端号：</td>
										<td align="left">
										<input type="text" maxlength="50" class="queryWidth"  name="termBeanList[0].tid" id="tid3" onblur="checkTidExist(this.value)"/><font color="red">*</font>
										</td>
									    <td> <input type="button" id="terminalDiv" value="添加" /></td>
									</tr>
									<tr>
										
									</tr>
									<tr>
										<td align="right" width="20%">机器序列号：</td>
										<td align="left" colspan="1"><input type="text" maxlength="20" readonly="readonly" id="serialNum3" class="queryWidth" name="termBeanList[0].serialNum" style="background-color: lightgray"/><font color="red">*</font><input type="button" value="选择" onclick="showPosInfoWindow(3)"/></td>
										
										<td align="right" width="20%">终端安装地址：</td>
										<td align="left" colspan="2"><input type="text" maxlength="50"  class="someWidth"  name="termBeanList[0].termAddress"/><font color="red">*</font></td>		
									</tr>
									<tr>
										<td align="right" width="20%">备注：</td>
										<td align="left" colspan="4"><input type="text" maxlength="65"  class="someWidth"  name="termBeanList[0].termNote"/></td>
									</tr>
									<tr>
										<td colspan="5"><input name="statIndex"  type="hidden" /></td>
										<%------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --%>
									</tr>
									</table>
				
								
						</td>
					
					
					</tr>
					
					
					<tr>
						<th colspan="6">开通功能</th>
					</tr>
					<tr>
						<td>
						（基本功能:<input id="allCheck" type="checkbox" />）
						</td>
						<td colspan="5">
								
									<s:checkboxlist name="transTypes" list="#request.tranTypeList" listKey="key" listValue="value"></s:checkboxlist>
							
						</td>
					</tr>
					<tr>
						<th colspan="6">商户交易限额</th>
					</tr>
					<tr>
						<td>贷记卡单笔限额：</td>
						
						<td><s:textfield id="amount" name="merDetail.amount1" maxLength="12" size="12"/>元 <font color="red">*</font></td>
						<td>终端贷记卡单日累计限额：</td>
						
						<td><s:textfield id="amountDay" name="merDetail.dayTotalAmt1" maxLength="12" size="12"/>元<font color="red">*</font></td>
						<td>商户贷记卡每月累计限额：</td>
						
						<td><s:textfield id="amountMouth" name="merDetail.monthTotAmt1" maxLength="12" size="12"/>元<font color="red">*</font> </td>
					</tr>
					<tr>
						<td>借记卡单笔限额 ：</td>
						
						<td><s:textfield id="amount1" name="merDetail.amount2" maxLength="12" size="12"/>元<font color="red">*</font></td>
						<td>终端借记卡单日累计限额：</td>
						
						<td><s:textfield id="amountDay1" name="merDetail.dayTotalAmt2" maxLength="12" size="12"/>元<font color="red">*</font></td>
						<td>商户借记卡每月累计限额：</td>
						
						<td><s:textfield id="amountMouth1" name="merDetail.monthTotAmt3" maxLength="12" size="12"/>元<font color="red">*</font></td>
					</tr>
					
					
					
					<tr>
						<th colspan="6">附件信息</th>
					</tr>
					<tr>
						<td style="text-align: right">法人证件：</td>
						
						<td style="text-align: left;" colspan="3" style="text-align: left"> <s:file id="file" name="file" title="附件上传" ></s:file> 
	
        				 <input type="button" value="提交" onclick="ajaxFileUpload('file')"/><font color="red">*</font>
        				<!--  <img src="http://localhost:8080/img/1407658503449.jpeg" /> -->
        				<span><font id="fileFont" color="red"></font> </span>
        				<input id="fileIput" type="hidden" name="merDetail.cardUrl" />
						 </td>
						
					</tr>
					<tr>
						<td style="text-align: right">合作协议1：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file10" name="file10" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file10')"/><font color="red">*</font>
							 <span><font id="file10Font" color="red"></font> </span>
							  <input id="file10Iput" type="hidden" name="merDetail.picUrl5" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">合作协议2：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file11" name="file11" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file11')"/><font color="red">*</font>
							 <span><font id="file11Font" color="red"></font> </span>
							  <input id="file11Iput" type="hidden" name="merDetail.picUrl6" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">商户信息调查表：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file7" name="file7" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file7')"/><font color="red">*</font>
							 <span><font id="file7Font" color="red"></font> </span>
							  <input id="file7Iput" type="hidden" name="merDetail.picUrl2" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">手持身份证照：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file12" name="file12" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file12')"/><font color="red">*</font>
							 <span><font id="file12Font" color="red"></font> </span>
							  <input id="file12Iput" type="hidden" name="merDetail.picUrl7" />
						</td>
					</tr>
					<tr id="file13Content">
						<td style="text-align: right">银行卡正反面：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file13" name="file13" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file13')"/> <font color="red">*</font>
							 <span><font id="file13Font" color="red"></font> </span>
							  <input id="file13Iput" type="hidden" name="merDetail.picUrl8" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">营业执照：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file2" name="file2" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file2')"/><font color="red">*</font>
							 <span><font id="file2Font" color="red"></font> </span>
							  <input id="file2Iput" type="hidden" name="merDetail.businessLicenseUrl" />
						</td>
					</tr>
					
					<tr>
						<td style="text-align: right">营业场地图片：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file5" name="file5" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file5')"/><font color="red">*</font>
							 <span><font id="file5Font" color="red"></font> </span>
							  <input id="file5Iput" type="hidden" name="merDetail.placeOfBusinessUrl" />
						</td>
					</tr>
					
					
					
					<tr>
						<td style="text-align: right">门头照：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file8" name="file8" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file8')"/><font color="red">*</font>
							 <span><font id="file8Font" color="red"></font> </span>
							  <input id="file8Iput" type="hidden" name="merDetail.picUrl3" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">收银台照片：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file9" name="file9" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file9')"/><font color="red">*</font>
							 <span><font id="file9Font" color="red"></font> </span>
							  <input id="file9Iput" type="hidden" name="merDetail.picUrl4" />
						</td>
					</tr>
					<tr id="file1Content">
						<td style="text-align: right">开户行许可证：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file1" name="file1" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file1')"/> 
							 <span><font id="file1Font" color="red"></font> </span>
							 <input id="file1Iput" type="hidden" name="merDetail.bankLicenseUrl" />
						</td>
						
					</tr>
					
					<tr id="file3Content">
						<td style="text-align: right">组织机构代码：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file3" name="file3" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file3')"/> 
							 <span><font id="file3Font" color="red"></font> </span>
							  <input id="file3Iput" type="hidden" name="merDetail.orgCodeUrl" />
						</td>
					</tr>
					<tr id="file4Content">
						<td style="text-align: right">税务登记证：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file4" name="file4" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file4')"/> 
							 <span><font id="file4Font" color="red"></font> </span>
							  <input id="file4Iput" type="hidden" name="merDetail.taxRegCertUrl" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">租赁合同：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file6" name="file6" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file6')"/> 
							 <span><font id="file6Font" color="red"></font> </span>
							  <input id="file6Iput" type="hidden" name="merDetail.picUrl1" />
						</td>
					</tr>
					
					<tr>
						<td style="text-align: right">备用1：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file14" name="file14" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file14')"/> 
							 <span><font id="file14Font" color="red"></font> </span>
							  <input id="file14Iput" type="hidden" name="merDetail.picUrl9" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right">备用2：</td>
						
						<td colspan="3" style="text-align: left"><s:file id="file15" name="file15" title="附件上传"></s:file>
							 <input type="button" value="提交" onclick="ajaxFileUpload('file15')"/> 
							 <span><font id="file15Font" color="red"></font> </span>
							  <input id="file15Iput" type="hidden" name="merDetail.picUrl10" />
						</td>
					</tr>
					<tr>
						<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="4"> 
						<s:submit id="btnAdd" value="保  存"/>
						 &nbsp;&nbsp; 
						<input type="reset"" value="取  消"/>
						 </td>
					</tr>
				</table>

			</s:form>
		</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
		alert("${request.msg}");
			window.location="<%=basePath%>/mer/addMerJspForReal.ct";
			
		</script>
	</s:if>
</body>
</html>
